<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // const arr = [1,2,3,4,5];
	// console.log(arr.includes(3));

    const arr = [
		{
			id:1,
            title:"体育"
        },{
		    id:2,
            title:"娱乐"
        },{
		    id:3,
            title:"财经"
        },
		{
			id:4,
			title:"财经"
		}
    ];
	// const bol = arr.some(function(item,index,array){
	// 	console.log(item,index,array)
    //     return item.id === 2;
    // });
	// console.log(bol)

    // find:查找满足条件的第一个元素，如果找不到返回的是undefined
    // const info = arr.find(function(item){
	// 	// console.log(item)
	// 	return item.id === 2;
    // })
	// console.log(info);

	// const info = arr.find(item=>item.id === 4)
	// console.log(info);

    // 查找第一个满足条件的元素所在的下标，如果找不到返回的是-1
	// const index = arr.findIndex(item=>item.id === 2)
	// console.log(index);

    const info = arr.filter(v=>v.title === "财经");
	console.log(info);


</script>
</html>